home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / kh_gdi.zip / GR_MAPP.CPP < prev    next >
C/C++ Source or Header  |  1996-05-04  |  3KB  |  139 lines

  1. /*  Project gdi_demo
  2.     
  3.     Copyright ⌐ 1995. All Rights Reserved.
  4.  
  5.     SUBSYSTEM:    gdi_demo.exe Application
  6.     FILE:         gd_dmapp.cpp
  7.     AUTHOR:       S.Vartanov
  8.  
  9.  
  10.     OVERVIEW
  11.     ========
  12.     Source file for implementation of gdi_demoApp (TApplication).      
  13. */
  14.  
  15.  
  16. #include <owl\owlpch.h>
  17. #pragma hdrstop
  18.  
  19.  
  20. #include "gd_dmapp.h"
  21. #include "gd_dmwnd.h"                        // Definition of client class.       
  22. #include "gd_dmabd.h"                        // Definition of about dialog.       
  23.  
  24. //{{gdi_demoApp Implementation}}
  25.  
  26.  
  27. //
  28. // Build a response table for all messages/commands handled
  29. // by the application.
  30. //
  31. DEFINE_RESPONSE_TABLE1(gdi_demoApp, TApplication)
  32. //{{gdi_demoAppRSP_TBL_BEGIN}}
  33.     EV_COMMAND(CM_HELPABOUT, CmHelpAbout),
  34. //{{gdi_demoAppRSP_TBL_END}}
  35. END_RESPONSE_TABLE;
  36.  
  37.  
  38. //////////////////////////////////////////////////////////
  39. // gdi_demoApp
  40. // =====
  41. //
  42. gdi_demoApp::gdi_demoApp () : TApplication("gdi_demo")
  43. {
  44.  
  45.     // Common file file flags and filters for Open/Save As dialogs.  Filename and directory are
  46.     // computed in the member functions CmFileOpen, and CmFileSaveAs.
  47.     FileData.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
  48.     FileData.SetFilter("All Files (*.*)|*.*|");
  49.  
  50.     // INSERT>> Your constructor code here.
  51. }
  52.  
  53.  
  54. gdi_demoApp::~gdi_demoApp ()
  55. {
  56.      // INSERT>> Your destructor code here.
  57. }
  58.  
  59.  
  60. //////////////////////////////////////////////////////////
  61. // gdi_demoApp
  62. // =====
  63. // Application intialization.
  64. //
  65. void gdi_demoApp::InitMainWindow ()
  66. {
  67.      if (nCmdShow != SW_HIDE)
  68.           nCmdShow = (nCmdShow != SW_SHOWMINNOACTIVE) ? SW_SHOWMAXIMIZED : nCmdShow;
  69.  
  70.      SDIDecFrame *frame = new SDIDecFrame(0, GetName(), 0, false);
  71.  
  72.      // Override the default window style for the main window.
  73.      frame->Attr.Style |= WS_BORDER | WS_CAPTION | WS_CLIPCHILDREN | WS_SYSMENU | WS_VISIBLE;
  74.      frame->Attr.Style &= ~(WS_CHILD | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_THICKFRAME);
  75.  
  76.      //
  77.      // Assign ICON w/ this application.
  78.      //
  79.      frame->SetIcon(this, IDI_SDIAPPLICATION);
  80.  
  81.      //
  82.      // Menu associated with window and accelerator table associated with table.
  83.      //
  84.      frame->AssignMenu(SDI_MENU);
  85.  
  86.      //
  87.      // Associate with the accelerator table.
  88.      //
  89.      frame->Attr.AccelTable = SDI_MENU;
  90.  
  91.  
  92.      SetMainWindow(frame);
  93.  
  94.      frame->SetMenuDescr(TMenuDescr(SDI_MENU));
  95. }
  96.  
  97.  
  98. //{{SDIDecFrame Implementation}}
  99.  
  100.  
  101. SDIDecFrame::SDIDecFrame (TWindow *parent, const char far *title, TWindow *clientWnd, bool trackMenuSelection, TModule *module)
  102.      : TDecoratedFrame(parent, title, clientWnd == 0 ? new gdi_demoWindow(0, "") : clientWnd, trackMenuSelection, module)
  103. {
  104.      // INSERT>> Your constructor code here.
  105.  
  106. }
  107.  
  108.  
  109. SDIDecFrame::~SDIDecFrame ()
  110. {
  111.     // INSERT>> Your destructor code here.
  112.  
  113. }
  114.  
  115.  
  116. //////////////////////////////////////////////////////////
  117. // gdi_demoApp
  118. // ===========
  119. // Menu Help About gdi_demo.exe command
  120. void gdi_demoApp::CmHelpAbout ()
  121. {
  122.      //
  123.      // Show the modal dialog.
  124.     //
  125.     gdi_demoAboutDlg(MainWindow).Execute();
  126. }
  127. int OwlMain (int , char* [])
  128. {
  129.      try {
  130.         gdi_demoApp    app;
  131.         return app.Run();
  132.     }
  133.     catch (xmsg& x) {
  134.         ::MessageBox(0, x.why().c_str(), "Exception", MB_OK);
  135.     }
  136.  
  137.     return -1;
  138. }
  139.